<!DOCTYPE html>
<html lang="en">

<head>
  <meta charset="UTF-8">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>计算属性</title>
</head>

<body>
  <pre>


      计算属性和方法的区别

          1.


  </pre>
  <div id="app">
    <p>{{reverse}}</p>
    <p>{{reverse}}</p>
    <p>{{handle()}}</p>
    <p>{{handle()}}</p>
  </div>
  <script src="./js/vue.js"></script>
  <script>

    var vm = new Vue({
      el: '#app',
      data: {
        msg: 'Hello',
      },

      methods: {
        handle: function () {
          console.log('methods')
          return this.msg.split('').reverse().join('')
        }
      },
      computed: {
        reverse: function () {
          console.log('reverse')
          return this.msg.split('').reverse().join('')
        },
      }

    })
  </script>
</body>

</html>